/**
 * @description 统一的头文件信息  复用
 * @author 大肘子
 */

import React, { FC } from 'react'
import { Inter } from 'next/font/google'
import Head from 'next/head'
import style from './index.module.scss'
import Script from 'next/script'
const inter = Inter({ subsets: ['latin'] })
type PropsType = {
  title: string
  desc?: string
  css?:string
  js?:string
  children: JSX.Element | JSX.Element[]
}

const PageWrapper: FC<PropsType> = props => {
  const { title = '', desc = '', children,css = '',js = '' } = props
  return (
    <>
      <Head>
        <title> {title}</title>
        <meta name="description" content={desc} />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="icon" href="/favicon.ico" />
        <style>{css}</style>
      </Head>
      <main className={`${style.main} ${inter.className}`}>{children}</main>
      <Script id='page-js'>{js}</Script>
    </>
  )
}

export default PageWrapper
